﻿using System;
using System.Collections.Generic;

using Ue.CQRS.Samples.Application.Query.Repositories;
using Ue.CQRS.Samples.Domain.Models;
using Ue.CQRS.Samples.Infrastructure;
using Ue.CQRS.Samples.Infrastructure.Data;
using Ue.CQRS.Samples.Application.Query.DataContracts;

namespace Ue.CQRS.Samples.Application.Query.Services
{
    public class BookService : Single<BookService>
    {
        private IRepository<Guid, BookContract> repository;

        public BookService()
        {
            this.repository = RepositoryFactory.GetRepository<BookContract>();
        }

        public BookContract FindBy(Guid id)
        {
            return this.repository[id];
        }

        public IEnumerable<BookContract> FindAll()
        {
            return this.repository.Values;
        }
    }
}